#ifndef CONF_H
#define CONF_H

#include "svstub.h"

#define	DEFAULT_HOST	"all"

#define	MAX_VAR		64
#define	MAX_PORTS	10
#define	MAX_IPS		10
#define	MAX_IP_LEN	64

#define CONF_FILE	"server.conf"
#define CONF_PORT	"port"
#define	CONF_IP		"ip"
#define	CONF_CONN	"connections"
#define CONF_DB		"dbname"
#define	CONF_CAP	"capacity"
#define	CONF_ALL	"all"
#define	MAX_PAR		20
#define	MAX_VAL		256

/**
 ** Gets configuration information from file
 **
 **	@param	file		The name of the file from whick to get the parameters.
 **	@param	port		Vector of ports in which to listen
 **	@param	ip			IP on whick to list. "all" mean all the server's ip.
 **	@param	connections	Maximum number of simultaneous downloads.
 **	@param	dbname		Name of the database for the server to use.
 **	@param	cap			Disk space in MB for the server application to use.
 ** @return 			Returns > 0 if ok or < 0 if error.
 **/
int
getConf(char * file, int * port, char * ip, int * connections, char * dbname,
		int * cap);

/**
 ** Parses comandline arguments provided to server on initiation
 **
 **	@param	file		The name of the file from whick to get the parameters.
 **	@param	port		Vector of ports in which to listen
 **	@param	ip			IP on whick to list. "all" mean all the server's ip.
 **	@param	connections	Maximum number of simultaneous downloads.
 **	@param	dbname		Name of the database for the server to use.
 **	@param	cap			Disk space in MB for the server application to use.
 ** @return 			Returns number of ports if ok or 0 if error ocurrred.
 **/		
int
parseConf(int argc, char * argv[], int * port, char * ip, int * connections,
		  char * dbname, int * cap);

#endif

